package com.ad.pet.common.data.utils;

import android.telephony.TelephonyManager;

import com.ad.pet.App;

import static android.content.Context.TELEPHONY_SERVICE;

/**
 * Created by ems on 2017/3/3.
 */

public class Utils {
    /**
     * 检查是否为null
     *
     * @param object
     * @param message
     * @param <T>
     * @return
     */

    public static <T> T checkNotNull(T object, String message) {
        if (object == null) {
            NullPointerException exception = new NullPointerException(message);
            exception.printStackTrace();
            throw exception;
        }
        return object;
    }


    public static String getDeviceId() {
        TelephonyManager TelephonyMgr = (TelephonyManager) App.getApp().getSystemService(TELEPHONY_SERVICE);
        return TelephonyMgr.getDeviceId();
    }
}
